package com.yonyou.crm.bpub.refervalue.service;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yonyou.crm.bpub.refervalue.entity.ReferDataVO;
import com.yonyou.crm.common.page.entity.Page;
import com.yonyou.crm.cum.contact.entity.ContactVO;
import com.yonyou.crm.cum.contact.service.ContactBizServiceImpl;

@Service
public class ContactRefervalue extends BaseRefervalue{

	@Autowired
	ContactBizServiceImpl service;
	
	@Override
	public <T extends Serializable> List<ReferDataVO> getRefervalues(Page<T> page, Map<String, Object> paraMap) {
		List<ContactVO> list = service.getRefervaluesForApp((Page<ContactVO>)page, paraMap);
		
		
		List<ReferDataVO> rsList = new ArrayList<ReferDataVO>();
		for (ContactVO vo : list) {
			ReferDataVO referDataVO = new ReferDataVO();
			referDataVO.setId(vo.getId().toString());
			referDataVO.setValue(vo.getName());
			List<String> itemDataList = new ArrayList<>();
			itemDataList.add(vo.getName());
			//TODO 根据funcode决定返回的数据内容
			
			referDataVO.setItemdatalist(itemDataList);
			
			rsList.add(referDataVO);
		}
		
		return rsList;
	}

}
